package Classroom2;

import java.lang.reflect.Constructor;

public class Test {
    public static void main(String[] args) throws Exception {
        //创建字节码对象
        Class clazz = Class.forName("Classroom2.Student");
        //构造方法
        Constructor c1 = clazz.getConstructor();
        Object o = c1.newInstance();
        System.out.println(o);

        Constructor c2 = clazz.getConstructor(String.class,int.class);
        Object o1 = c2.newInstance("张三",19);
        System.out.println(o1);
    }
}
